ALTER   PROC sp_insert_ct_gp_vendor_address_mappings( @ctAddressId INT, @gpAddressId INT ) 
AS
BEGIN
DECLARE @tempAddressId INT

	IF @ctAddressId <> -1
	BEGIN
		SELECT @tempAddressId = CT_Address_Id FROM CT_GP_Vendor_Address_Mapping WHERE CT_Address_Id = @ctAddressId
		
		IF @tempAddressId IS NULL
		BEGIN
			INSERT INTO CT_GP_Vendor_Address_Mapping VALUES ( @ctAddressId, @gpAddressId )
		END
		ELSE
		BEGIN
			UPDATE CT_GP_Vendor_Address_Mapping SET GP_Address_Id = @gpAddressId WHERE CT_Address_Id = @ctAddressId
		END
	END	
END

